UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tQZ1lC4KxN6cDTPuw0BrseJW14m2SGswNlTyfiqU7h0='
WHERE
key_id = '3b3dd295ff778a5c42ca5baa99329cd54f44c856c577400b88a0c7125a699d4a'
AND (
token = 'tQZ1lC4KxN6cDTPuw0BrseJW14m2SGswNlTyfiqU7h0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)