UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4JfEj6q2PT4sJlhmUgI5K6atimzO9AncM3rZc8v1LMQ='
WHERE
key_id = '662c43a417946b9cd50865faddecaa291e9ef2ad71383fe038ee6ab8b5191a33'
AND (
token = '4JfEj6q2PT4sJlhmUgI5K6atimzO9AncM3rZc8v1LMQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)