UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gs6X+b0qW9t+VvNPMmPwyc/fyBxX4cqgwjjxXdesntM=' 
WHERE 
  key_id = '25ccd5ccb6b8e6f04d71b1c44ee3ff3346fe8ee87f337f1af9837d451843ec1b' 
  AND (
    token = 'Gs6X+b0qW9t+VvNPMmPwyc/fyBxX4cqgwjjxXdesntM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030