UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yKlrSYQmzfKRJKfFIs6IHLLuZsgChcZl1yMMglJM4lc=' 
WHERE 
  key_id = '5250e400f7ef6ebf6bce605e178f241dc59b92fc01759e70cfc2ae46565c3834' 
  AND (
    token = 'yKlrSYQmzfKRJKfFIs6IHLLuZsgChcZl1yMMglJM4lc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032