UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QsdJyjPH2BbfNiRMA1KBFC/GdL4ZMQXpczeePp3Sb7A='
WHERE
key_id = '1464891287a3d6c78914191a6a69c290f42674d5516be075ab42c3984b99500e'
AND (
token = 'QsdJyjPH2BbfNiRMA1KBFC/GdL4ZMQXpczeePp3Sb7A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)