UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z/NwFgZc4+H3XTNGoTnuCGfmfvslJ6ObGrp29t5Fksc='
WHERE
key_id = 'af2b49ac37b37ba90ef6524adaffefca0e29df5a33fe147f48010df5e9a9bf43'
AND (
token = 'Z/NwFgZc4+H3XTNGoTnuCGfmfvslJ6ObGrp29t5Fksc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)