UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9b7UI33GN1TADRBIjofwTcU8UA2wfaeyDxIjafoyiwk=' 
WHERE 
  key_id = '746fdd06a74480a5b54070b5e4278d78fcf140ea579b7025bbbf5b5f5823b6c6' 
  AND (
    token = '9b7UI33GN1TADRBIjofwTcU8UA2wfaeyDxIjafoyiwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033