UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g2cv9rDMO4yFG+XD1nLQdAztwcJoaSoHFCxS+5wJ1ms='
WHERE
key_id = 'aa43e651309b945889312cd4aaf7f85a685b3c29ccb43b16f325e57a6e8f5a8b'
AND (
token = 'g2cv9rDMO4yFG+XD1nLQdAztwcJoaSoHFCxS+5wJ1ms='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)