UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ue96HzsGmqc2a5viZeZBPmqiUuqdMOUNCNGvZl/Jxr0=' 
WHERE 
  key_id = 'f37d42e233241cd89954d83965d4dbdac8fdebdee226006293959dc62956732f' 
  AND (
    token = 'ue96HzsGmqc2a5viZeZBPmqiUuqdMOUNCNGvZl/Jxr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025