UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A4yE89MA+wbvsNuP0GdegB5/nAgjQFZ0Zi/nDOU9mho='
WHERE
key_id = 'afa27e77a52e13aaa0b0eb1f320ce1fd3830ec207e823489c103c30fd0ec305f'
AND (
token = 'A4yE89MA+wbvsNuP0GdegB5/nAgjQFZ0Zi/nDOU9mho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)