UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M5/9meh7o0JM4vpzquiFPPVbEl6NRXEcVdV1vQYgzss='
WHERE
key_id = 'a1f63604611a951c9cf4bb87728391361a41d534bb6bd983748714385ab5afce'
AND (
token = 'M5/9meh7o0JM4vpzquiFPPVbEl6NRXEcVdV1vQYgzss='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)