UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kmQwTXVbfyU+6KI9AilWmegBXOQKuRyC6F0vWTnnZ/4=' 
WHERE 
  key_id = '521c11048f785d2d4397e62271dc44ce09be14d944d60b0a1565d37f508ad207' 
  AND (
    token = 'kmQwTXVbfyU+6KI9AilWmegBXOQKuRyC6F0vWTnnZ/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034