UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yrhXJ36pW/6O1k5oFNiMHBD3wDhrnepTvAQSnu+5Mao=' 
WHERE 
  key_id = '40f09f190816121da61a7c85e400f7be139b4f8cee74e42f8aa884f4743d15fe' 
  AND (
    token = 'yrhXJ36pW/6O1k5oFNiMHBD3wDhrnepTvAQSnu+5Mao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024