UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'byJRY3Ia3rfJKnITTvemyC0Hzt3rhghTLeSzWsE3+cs='
WHERE
key_id = '510384a083e88937bf2ffd1575d6433dfa8051b1a8b6acb3070ee3c129b857bf'
AND (
token = 'byJRY3Ia3rfJKnITTvemyC0Hzt3rhghTLeSzWsE3+cs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)