UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UCwx7l+dvG+EAGNGfHuc32sW9JFFviEfFD19H7N+Gks=' 
WHERE 
  key_id = 'a0218c991f58b3a05cd0ed0fd1e934738c98e3ffb2573b70dac64be5f9012a59' 
  AND (
    token = 'UCwx7l+dvG+EAGNGfHuc32sW9JFFviEfFD19H7N+Gks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027