UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K2ciSLU8CwB6OISq48bcYICBqeK1WwmNQTLmHF9HSAA='
WHERE
key_id = 'aa472c28ee24fec4e8049e22b29286f831dd04aad85429a67818cef4af3fe594'
AND (
token = 'K2ciSLU8CwB6OISq48bcYICBqeK1WwmNQTLmHF9HSAA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)