UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wKl1EdQP9+kObr1D9Bzhjoea8brX91ztUeeEMU4HwDg='
WHERE
key_id = '6519e75893ccb15f68dd346ea30a65eac71289de3e073e0ff3eac8e42ce3dac1'
AND (
token = 'wKl1EdQP9+kObr1D9Bzhjoea8brX91ztUeeEMU4HwDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)