UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S5FFN7F0diByS45MqQdQ7h1NDaNVUbN2h9+C8aDndiQ='
WHERE
key_id = 'dc4eb4517ca4faa3a001c5ada297a4302cf9037af1c005c00dfd42ba4f962f0a'
AND (
token = 'S5FFN7F0diByS45MqQdQ7h1NDaNVUbN2h9+C8aDndiQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)