UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pp3z1kimTMtgOtIPPXlK/jdIUuUSk/owrgkeA2//c4g=' 
WHERE 
  key_id = 'e9aeb1def80b97dbe588aaa96105772905faf7b2d571f43d30f9bad107dad3c0' 
  AND (
    token = 'Pp3z1kimTMtgOtIPPXlK/jdIUuUSk/owrgkeA2//c4g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036