UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XnwxFDeMSuwzhSf8mWIwYk3vW8r8Z+RT6UH/FpENDm4='
WHERE
key_id = '6501c3241e9df37af472ecd2f93f6e6abee0cbe9eb89a8728b8fee7dc52979f8'
AND (
token = 'XnwxFDeMSuwzhSf8mWIwYk3vW8r8Z+RT6UH/FpENDm4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)