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