UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hric6C/0L8UHFgLjy6HfczsupBVaUd2kAx8OWuJv0h8='
WHERE
key_id = '05736a07098a44da3ca0254b4398232a9b167175760cb0e74a73b5bcb77aa002'
AND (
token = 'Hric6C/0L8UHFgLjy6HfczsupBVaUd2kAx8OWuJv0h8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)