UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ai+4bDir1X6nXqC6z1XgjZsMg9Pj7haXDDyqDisVEFo='
WHERE
key_id = '1fdc6859f9bc497c5a12f6c256866d94649ff88c77bff43dbb0e160be068e90a'
AND (
token = 'Ai+4bDir1X6nXqC6z1XgjZsMg9Pj7haXDDyqDisVEFo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)