UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ma0n7PBO48/MjAxaC4GJs8uwbiCLVath9cRHFa2uX7M='
WHERE
key_id = 'd5deedb5d6d7178374840d05e5474bdc7f41e0dba92c54155954845348c38481'
AND (
token = 'Ma0n7PBO48/MjAxaC4GJs8uwbiCLVath9cRHFa2uX7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)