UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tPCkP6mqXUtAuhHL5B/8FL+i1nS2xrxi4uNcjlwBOWI=' 
WHERE 
  key_id = '32235fdd0627644a0675412fd419bdd68ff78e31031a6991e8fc1390332eb959' 
  AND (
    token = 'tPCkP6mqXUtAuhHL5B/8FL+i1nS2xrxi4uNcjlwBOWI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032