UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U8kRivyXcD3UWMZD4tf9qHncAivAEJRQ/3bz5j/o85U='
WHERE
key_id = 'cd9da799dcd57cadcc41386b47c676e944926ddc0f187a3991ce7bb0c85c47e1'
AND (
token = 'U8kRivyXcD3UWMZD4tf9qHncAivAEJRQ/3bz5j/o85U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)