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