UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'srTbAC9sMsb9dQ/OBnGDKOYaEE+WNluoqmhaiiBjn8Y=' 
WHERE 
  key_id = 'f3ae84f01ac860e93b53b15f03d40874e381a0e59f0f43b45ebfca5fc2a6a83c' 
  AND (
    token = 'srTbAC9sMsb9dQ/OBnGDKOYaEE+WNluoqmhaiiBjn8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033