UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TJMf2AFlcojxsF3jsGLU12HstUNJ6pIvZJoFrQPJefM=' 
WHERE 
  key_id = 'b2074a4aaa1362c3a4f433eac58ed245d6d4b18aaabc6d027e857a29b1883ba4' 
  AND (
    token = 'TJMf2AFlcojxsF3jsGLU12HstUNJ6pIvZJoFrQPJefM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014