UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9N2Wk8ksEfjwhElw4Mk0Ttc7XgMefZdbNGkBws2iyxw='
WHERE
key_id = 'f06f9d49f016ffd32688324543e29ecf72f133a17e23a5f157d5b7640c548909'
AND (
token = '9N2Wk8ksEfjwhElw4Mk0Ttc7XgMefZdbNGkBws2iyxw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)