UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'arUFy7JyjUTgjU0SYqP/OAREYEatoDrhTWqH75ErCgc='
WHERE
key_id = 'e5a9c5e568c335bc61ba8eef9ab5dba1874613984426ff5c6a683b300627ce6e'
AND (
token = 'arUFy7JyjUTgjU0SYqP/OAREYEatoDrhTWqH75ErCgc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)