UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rAIA+3xYgVj+Cx7i8XmwTlPzPRbpLXxRnTsr0rmzlY8=' 
WHERE 
  key_id = '8b2d771ef83edf5bd9329ee91f35d1e7a6ec4be32b3601da47dee53e3113683a' 
  AND (
    token = 'rAIA+3xYgVj+Cx7i8XmwTlPzPRbpLXxRnTsr0rmzlY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039