UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2ff/dLkXSJ0ubdUzEcUsF+OOTYHOMX856xjAXVm0Huk='
WHERE
key_id = '51be325cf891f57a836c7c2c9933fc75dc7f1a0da16a44bb818cbe494edc54a3'
AND (
token = '2ff/dLkXSJ0ubdUzEcUsF+OOTYHOMX856xjAXVm0Huk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)